package com.dpf.hou.service.imp;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.dpf.hou.mapper.NoticeMapper;
import com.dpf.hou.pojo.Adoption;
import com.dpf.hou.pojo.Notice;
import com.dpf.hou.pojo.User;
import com.dpf.hou.service.NoticeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;

@Service
public class NoticeServiceImp implements NoticeService {
    @Autowired
    private NoticeMapper noticeMapper;
    @Override
    public Page<Notice> getNoticePage(int page, int size) {

        Page<Notice> p=new Page<>(page,size);

        return noticeMapper.selectPage(p,null);
    }

    @Override
    public boolean addNotice(Notice notice) {
        Date d=new Date();
        notice.setNtime(d);
        int rows=noticeMapper.insert(notice);
        return rows == 0 ? false:true;
    }
}
